{extend name="base" /} {block name="body"}
<div class="layui-body">
	<!--tab标签-->
	<div class="layui-tab layui-tab-brief">
		<ul class="layui-tab-title">
			<li class="">
				<a href="{:url('ad/index')}">首页图片</a>
			</li>
			<li class="layui-this">添加图片</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<form class="layui-form form-container" action="{:url('ad/add_upload')}" method="post">
					<!--<div class="layui-form-item">
						<label class="layui-form-label">标题</label>
						<div class="layui-input-block">
							<input type="text" name="title" value="" required lay-verify="required" placeholder="请输入标题" class="layui-input">
						</div>
					</div>-->
					<div class="layui-form-item">
						<label class="layui-form-label" style="width: 100px;">图片跳转地址</label>
						<div class="layui-input-block">
							<input type="text" style="width: 75%;" name="url" value="{:url('index/order/index')}" placeholder="默认认筹中心" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="gerenzl_top img-click">
						<div class="actions" style="text-align: center;">
							<button type="button" class="layui-btn" id="test1">
							  <i class="layui-icon">&#xe67c;</i>上传图片
							</button>
							<div class="layui-upload">
								<div class="layui-upload-list" style="margin: unset;">
								   <img class="layui-upload-img" id="logo" src="">
								   <input type="hidden" name='thumb' id='thumb' />
								</div>
							</div>  
						</div>
					</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">状态</label>
						<div class="layui-input-block">
							<input type="radio" name="status" value="1" checked title="显示">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="*">保存</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="js"}
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/static/layui/layui.all.js"></script>
<script>
	layui.use('upload', function() {
		var upload = layui.upload;

		//普通图片上传
		var uploadInst = upload.render({
			elem: '#test1',
			auto: false //选择文件后不自动上传
				,
			choose: function(obj) {
				//将每次选择的文件追加到文件队列
				var files = obj.pushFile();

				//预读本地文件，如果是多文件，则会遍历。(不支持ie8/9)
				obj.preview(function(index, file, result) {
					$('#logo').attr('src', result); //图片链接（base64）
					$('#test1').hide();
					$('#thumb').val(result); //图片链接（base64）
					
				});
			},
			url: "{:url('index/member/upload')}",
			accept: 'images'
		});
	});
</script>

{/block}